# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

{
    'includes': [
        'configure.gypi',
    ],
    'targets': [
    #
    # seven-summits SMT solving server
    #
    {
        'target_name': 'seven_summits_lib',
        'type': 'static_library',
        'include_dirs': [ 'src', ],
        'sources': [
             'src/connection.cpp',
             'src/connection.h',
             'src/connection_queue.h',
             'src/stp_worker.cpp',
             'src/stp_worker.h',
             'src/worker.cpp',
             'src/worker.h',
             'src/worker_pool.cpp',
             'src/worker_pool.h',
        ],
        'dependencies': [
             'expr',
             'solver',
             'src/proto/proto.gyp:seven_summits_proto',
             'third_party/event2.gyp:libevent2',
             'third_party/llvmsys.gyp:libllvmsys',
             'third_party/glog.gyp:libglog',
        ],
        'export_dependent_settings': [
             'expr',
             'solver',
             'src/proto/proto.gyp:seven_summits_proto',
             'third_party/event2.gyp:libevent2',
             'third_party/llvmsys.gyp:libllvmsys',
             'third_party/glog.gyp:libglog',
        ],
    },
    #
    # seven-summits SMT solving server executable
    #
    {
        'target_name': 'seven_summits',
        'type': 'executable',
        'include_dirs': [ 'src' ],
        'sources': [
             'src/main.cpp'
         ],
        'dependencies': [
             'seven_summits_lib',
        ],
    },
    #
    # unit tests
    #
    {
        'target_name': 'seven_summits_test',
        'type': 'executable',
        'include_dirs': [ 'src', ],
        'sources': [
             'src/connection_test.cpp',
        ],
        'dependencies': [
             'seven_summits_lib',
             'third_party/gmock.gyp:gmock',
             'third_party/gtest.gyp:gtest_main',
        ],
    },
    #
    # expr library
    #
    {
        'target_name': 'expr',
        'type': 'static_library',
        'sources': [
            'src/expr/Assignment.h',
            'src/expr/Constraints.h',
            'src/expr/Constraints.cpp',
            'src/expr/ExprEvaluator.cpp',
            'src/expr/ExprEvaluator.h',
            'src/expr/ExprPPrinter.h',
            'src/expr/ExprPPrinter.cpp',
            'src/expr/ExprUtil.cpp',
            'src/expr/ExprUtil.h',
            'src/expr/ExprVisitor.cpp',
            'src/expr/ExprVisitor.h',
            'src/expr/Expr.cpp',
            'src/expr/Expr.h',
            'src/expr/ExprBuilder.cpp',
            'src/expr/ExprBuilder.h',
            'src/expr/Lexer.cpp',
            'src/expr/Lexer.h',
            'src/expr/Parser.cpp',
            'src/expr/Parser.h',
            'src/expr/Updates.cpp',
        ],
        'include_dirs': [ 'src', ],
        'dependencies': [
            'third_party/llvmsys.gyp:libllvmsys',
        ],
    },
    #
    # solver library
    #
    {
        'target_name': 'solver',
        'type': 'static_library',
        'include_dirs': [ 'src', ],
        'sources': [
            'src/Solver.h',
            'src/SolverImpl.h',
            'src/solver/ConstantDivision.h',
            'src/solver/ConstantDivision.cpp',
            'src/solver/Solver.cpp',
            'src/solver/STPBuilder.h',
            'src/solver/STPBuilder.cpp',
        ],
        'dependencies': [
            'expr',
            'src/proto/proto.gyp:seven_summits_proto',
            'third_party/llvmsys.gyp:libllvmsys',
            'third_party/stp.gyp:libstp',
        ],
        'link_settings': {
            'libraries': [
                '-lprotobuf',
            ],
            'include_dirs': [
                '<(libstpinclude)'
            ]
        }

    },
    #
    # Stub library
    #
    {
        'target_name': 'seven_summits_stub',
        'type': 'static_library',
        'include_dirs': [ 'src', ],
        'sources': [
             'src/stub-inl.h',
             'src/stub.h',
        ],
        'dependencies': [
             'third_party/glog.gyp:libglog',
        ],
        'export_dependent_settings': [
             'third_party/glog.gyp:libglog',
        ],
    },
    #
    # Simple client program that sends a query to the server.
    #
    {
        'target_name': 'simple_client',
        'type': 'executable',
        'include_dirs': [ 'src' ],
        'sources': [
            'src/simple_client.cpp',
        ],
        'dependencies': [
            'seven_summits_stub',
            'src/proto/proto.gyp:seven_summits_proto',
            'third_party/llvmsys.gyp:libllvmsys',
            'third_party/glog.gyp:libglog',
        ],
    }],
}
